﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Ditto.Models.Items>" %>

<div>
<h3>Inventory (<%: Model.Count().ToString() %>)</h3>
<ul>
<% foreach (var item in Model) { %>
            <li class="summary" style="position:relative">
                <div class="image" style="float:left;vertical-align:top">
                    <a href="/<%= item.ItemID %>"><img class="resized" alt="<%= item.Title %>" src="/Content/<%= item.ItemPicture1 %>-small.jpg" /></a>
                </div>

                <div style="float:left;width:440px;margin:0">
                    <%: Html.ActionLink(item.Title, "Details", "Items", new { id=item.ItemID }, null) %>
                    on 
                    <strong><%: item.TimeCreated.ToString("yyyy-MMM-dd")%> 
                    <%: item.TimeCreated.ToString("HH:mm tt")%></strong>
                    at 
                    <%: item.Address + " " + item.Country %>
                </div>

                <% if (item.HasTransactions())
                   { %>
                        <p style="position:absolute;bottom:0px;right:0px">
                        see <%: Html.ActionLink("transaction", "RelatedTransaction", "Items", new { id = item.ItemID }, null)%>
                        </p>
                <%} %>
            </li>
        
        <% } %>

        <% if (Model.Count() == 0) { %>
           <li class="summary">User has not posted any items.</li>
        <% } %>

</ul>
</div>

<script src="/Scripts/jquery.myimgscale-0.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("img.resized").scaleImage({
            parent: '.image',
            center: false,
            fade: 500
        });
    });
</script>